package com.zjp.exception;

import java.io.IOException;

import net.iharder.Base64;
import com.zjp.utils.common.convertor.Convertor;

public class Base64Convertor  implements Convertor<byte[]> {

	public byte[] parse(String strValue) {
		try {
			return Base64.decode(strValue);
		} catch (IOException e) {		
			e.printStackTrace();
			throw new RuntimeException("Decode with Base64 error.");
		}
	}

	public String format(byte[] value) {
		return Base64.encodeBytes(value);
	}

}